﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Practices.Unity;
using Shatkotha.WPF.Global.Data;
using Shatkotha.WPF.Global.Data.BLL;
using Shatkotha.WPF.Global.Data.DAL;

namespace BLL
{
    public class PersonManager : IPersonManager
    {
        public PersonManager(IUnityContainer container)
        {
            Container = container;
            Dal = Container.Resolve<IPersonDal>();
        }

        public IUnityContainer Container { get; set; }

        public IPersonDal Dal { get; set; }

        public IPerson GetPerson(long id)
        {
            return Dal.GetPerson(id); ;
        }

        public ObservableCollection<IPerson> GetAllPerson()
        {
            return Dal.GetAllPerson();
        }

        public IPerson CreateNewPerson(IPerson person)
        {
            return Dal.AddPerson(person);
        }
    }
}
